home *** CD-ROM | disk | FTP | other *** search
- Path: news.internetMCI.com!news-admin
- From: Bret Hill <bhill@lanier.com>
- Newsgroups: comp.lang.c
- Subject: Subclass edit control for date in windows?
- Date: 12 Jan 1996 20:51:58 GMT
- Organization: InternetMCI
- Message-ID: <4d6hle$qmf@news.internetmci.com>
- NNTP-Posting-Host: usr1-dialup9.atlanta.mci.net
-
- First of all I, as a new internet user, would like to know if I am
- in the proper newsgroup to be asking this next question.
-
- Does anyone have a decent proc for subclassing edit controls for
- dates?
-
- I am currently subclassing an edit controll on a dialog box for a
- date field. It's very simple right now: On a WM_CHAR I send the
- message to the old edit proc, I then reformat the text in the edit
- box (take out letters, put in slashes). Example:
-
- switch (message)
- {
- case WM_CHAR:
- CallWindowProc(lpfnOldEditProc,hWnd,message,wParam,lParam);
- GetWindowText(hWnd,datestr,14);
-
- i=MaskDate(datestr); // (my date formatting function)
- SetWindowText(hWnd,datestr);
- return 0;
- }
- return CallWindowProc(lpfnOldEditProc,hWnd,message,wParam,lParam);
-
- I'm having problems with the positioning of the text cursor after
- the SetWindowText. I've tried several ways to get the text cursor
- to the proper position, but it boils down to sending multiple VK_RIGHT
- messages to the OldEditProc which doesn't work to well.
-
- Suggestions or Ideas?
-
-